<%@page import="com.office.automate.model.authenticate.UserAuthenticator"%>
<%@page import="com.office.automate.exception.framework.FrontierVisibleException"%>
<%@page import="com.office.automate.validation.framework.ValidatorObject"%>
<%@page import="com.office.automate.frontier.utility.ExceptionMessagesManagement"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@ include file="jsp/common/CommonHeaderInfo.jsp"%>
<title>Office Automation System</title>
</head>
<body>
	<%@ include file="jsp/common/SiteBanner.jsp" %>
	<%
	
	boolean isValidationErrorExist = false;
	ExceptionMessagesManagement exceptionMessagesManagement  = null;
	ValidatorObject validationErrors = (ValidatorObject) request.getAttribute("FieldValidationErrors");
	FrontierVisibleException operationalExcaption = (FrontierVisibleException) request.getAttribute("OperationalError");
	UserAuthenticator anUserAuthenticator = (UserAuthenticator) request.getAttribute("UserAuthenticator");
	if (validationErrors != null) {
		exceptionMessagesManagement = new ExceptionMessagesManagement(validationErrors.getValidationErrorList());
		isValidationErrorExist = true;
	}
	
	%>
	<tr>
		<td height="60px">
		
		</td>
	</tr>
	<% if (operationalExcaption != null) { %>
		<tr>
			<td>
				<table width="100%" class="loginfaliererror">
					<tr>
						<td>
							<center>
								<font class="loginfaliererrorfont"> <b>Unable to login to the due to <%=operationalExcaption.getDetailsErrorMessage() %> </b> <br /> </font>
							</center>
						</td>
					</tr>
		
				</table>
			</td>
		</tr>
	<% } %>
	<tr>
		<td align="center">
			<form name="login_main" method="post" action="SystemLoginControle">
				<table>
					<tr>
						<td align="center"><b>Username</b></td>
						<td align="right">: <input type="text" name="username" <% if (isValidationErrorExist) { %>value="<%=anUserAuthenticator.getUsername() %>" <% } %> /></td>
					</tr>
					<%
					 if (isValidationErrorExist && exceptionMessagesManagement.checkExistenceOfErrorByKey("username")) {
					%>
						<tr>
							<td colspan="2"><font class="errorMessageStyles"> <%=exceptionMessagesManagement.getDetailExceptionMessage("username")  %> </font></td>
						</tr>
					<%
					 }
					%>
					<tr>
						<td align="center"><b>Password</b></td>
						<td align="right">: <input type="password" name="password" <% if (isValidationErrorExist) { %>value="<%=anUserAuthenticator.getPassword() %>" <% } %> /></td>
					</tr>
					<%
					 if (isValidationErrorExist && exceptionMessagesManagement.checkExistenceOfErrorByKey("password")) {
					%>
						<tr>
							<td colspan="2"><font class="errorMessageStyles"> <%=exceptionMessagesManagement.getDetailExceptionMessage("password")  %> </font></td>
						</tr>
					<%
					 }
					%>
					<tr align="right">
						<td colspan="2"><input type="submit" name="submit" value="Submit" /></td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
	<tr>
		<td class="loginpagewhite">
			
		</td>
	</tr>
	<%@ include file="jsp/common/SiteFotterSection.jsp" %>
</body>
</html>